// DlgSocket.cpp : implementation file
//

#include "stdafx.h"
#include "dlltool.h"
#include "DlgHookSocket.h"
#include "HOOKSOCK.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgHookSocket dialog


CDlgHookSocket::CDlgHookSocket(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgHookSocket::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgHookSocket)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDlgHookSocket::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgHookSocket)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgHookSocket, CDialog)
	//{{AFX_MSG_MAP(CDlgHookSocket)
	ON_BN_CLICKED(IDC_BN_HOOK_RECV, OnBnHookRecv)
	ON_BN_CLICKED(IDC_BN_ATTACH_WSASEND, OnBnAttachWsasend)
	ON_BN_CLICKED(IDC_BN_ATTACH_RECVFROM, OnBnAttachRecvfrom)
	ON_BN_CLICKED(IDC_BN_ATTACH_SEND, OnBnAttachSend)
	ON_BN_CLICKED(IDC_BN_ATTACH_SENDTO, OnBnAttachSendto)
	ON_BN_CLICKED(IDC_BN_ATTACH_WSARECV, OnBnAttachWsarecv)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgSocket message handlers

void CDlgHookSocket::OnBnHookRecv() 
{
	// TODO: Add your control notification handler code here
	int nret = HookRecv();
	switch(nret)
	{
	case 1:
		::SetWindowText(::GetDlgItem(this->m_hWnd,IDC_BN_HOOK_RECV),"UNRecv"); 
		break;
	case 2:
		::SetWindowText(::GetDlgItem(this->m_hWnd,IDC_BN_HOOK_RECV),"Recv"); 
		break;
	default:
		break;
	}
}

void CDlgHookSocket::OnBnAttachWsasend() 
{
	// TODO: Add your control notification handler code here
	
	int nret = HookWSASend();
	switch(nret)
	{
	case 1:
		::SetWindowText(::GetDlgItem(this->m_hWnd,IDC_BN_ATTACH_WSASEND),"UNWSASend"); 
		break;
	case 2:
		::SetWindowText(::GetDlgItem(this->m_hWnd,IDC_BN_ATTACH_WSASEND),"WSASend"); 
		break;
	default:
		break;
	}
}

void CDlgHookSocket::OnBnAttachRecvfrom() 
{
	// TODO: Add your control notification handler code here
	
}

void CDlgHookSocket::OnBnAttachSend() 
{
	// TODO: Add your control notification handler code here
	int nret = HookSend();
	switch(nret)
	{
	case 1:
		::SetWindowText(::GetDlgItem(this->m_hWnd,IDC_BN_ATTACH_SEND),"UNSend"); 
		break;
	case 2:
		::SetWindowText(::GetDlgItem(this->m_hWnd,IDC_BN_ATTACH_SEND),"Send"); 
		break;
	default:
		break;
	}
}

void CDlgHookSocket::OnBnAttachSendto() 
{
	// TODO: Add your control notification handler code here
	
}

void CDlgHookSocket::OnBnAttachWsarecv() 
{
	// TODO: Add your control notification handler code here
	int nret = HookWSARecv();
	switch(nret)
	{
	case 1:
		::SetWindowText(::GetDlgItem(this->m_hWnd,IDC_BN_ATTACH_WSARECV),"UnWSARecv"); 
		break;
	case 2:
		::SetWindowText(::GetDlgItem(this->m_hWnd,IDC_BN_ATTACH_WSARECV),"WSARecv"); 
		break;
	default:
		break;
	}	
}
